﻿namespace Sidvall.AuthorizationManager.Net.Services.V1
{
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")]
    public sealed partial class AuthorizationScope : global::Sidvall.Data.ServiceDataRowBase, global::Sidvall.AuthorizationManager.Data.IAuthorizationScope
    {
        #region Public Members

        #region AuthorizationScopeId

        private System.Nullable<long> _AuthorizationScopeId;
        partial void OnBeforeAuthorizationScopeIdPropertyChanged(Sidvall.Business.PropertyChangeEventData<System.Nullable<long>> eventData);
        partial void OnAfterAuthorizationScopeIdPropertyChanged();
        public System.Nullable<long> AuthorizationScopeId
        { 
            get
            {
                return _AuthorizationScopeId;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _AuthorizationScopeId = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<System.Nullable<long>> eventData = new Sidvall.Business.PropertyChangeEventData<System.Nullable<long>>(value, _AuthorizationScopeId);
                    OnBeforeAuthorizationScopeIdPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("AuthorizationScopeId", eventData.Value, true, true);
                        OnAfterAuthorizationScopeIdPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region DefaultResourceActionAccessLevel

        private global::Sidvall.AuthorizationManager.Data.AuthorizationScopeAccessLevel _DefaultResourceActionAccessLevel;
        partial void OnBeforeDefaultResourceActionAccessLevelPropertyChanged(Sidvall.Business.PropertyChangeEventData<global::Sidvall.AuthorizationManager.Data.AuthorizationScopeAccessLevel> eventData);
        partial void OnAfterDefaultResourceActionAccessLevelPropertyChanged();
        public global::Sidvall.AuthorizationManager.Data.AuthorizationScopeAccessLevel DefaultResourceActionAccessLevel
        { 
            get
            {
                return _DefaultResourceActionAccessLevel;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _DefaultResourceActionAccessLevel = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<global::Sidvall.AuthorizationManager.Data.AuthorizationScopeAccessLevel> eventData = new Sidvall.Business.PropertyChangeEventData<global::Sidvall.AuthorizationManager.Data.AuthorizationScopeAccessLevel>(value, _DefaultResourceActionAccessLevel);
                    OnBeforeDefaultResourceActionAccessLevelPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("DefaultResourceActionAccessLevel", eventData.Value, true, true);
                        OnAfterDefaultResourceActionAccessLevelPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region DefaultResourceItemAccessLevel

        private global::Sidvall.AuthorizationManager.Data.AuthorizationScopeAccessLevel _DefaultResourceItemAccessLevel;
        partial void OnBeforeDefaultResourceItemAccessLevelPropertyChanged(Sidvall.Business.PropertyChangeEventData<global::Sidvall.AuthorizationManager.Data.AuthorizationScopeAccessLevel> eventData);
        partial void OnAfterDefaultResourceItemAccessLevelPropertyChanged();
        public global::Sidvall.AuthorizationManager.Data.AuthorizationScopeAccessLevel DefaultResourceItemAccessLevel
        { 
            get
            {
                return _DefaultResourceItemAccessLevel;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _DefaultResourceItemAccessLevel = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<global::Sidvall.AuthorizationManager.Data.AuthorizationScopeAccessLevel> eventData = new Sidvall.Business.PropertyChangeEventData<global::Sidvall.AuthorizationManager.Data.AuthorizationScopeAccessLevel>(value, _DefaultResourceItemAccessLevel);
                    OnBeforeDefaultResourceItemAccessLevelPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("DefaultResourceItemAccessLevel", eventData.Value, true, true);
                        OnAfterDefaultResourceItemAccessLevelPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region DefaultUserContext

        private string _DefaultUserContext;
        partial void OnBeforeDefaultUserContextPropertyChanged(Sidvall.Business.PropertyChangeEventData<string> eventData);
        partial void OnAfterDefaultUserContextPropertyChanged();
        public string DefaultUserContext
        { 
            get
            {
                return _DefaultUserContext;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _DefaultUserContext = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<string> eventData = new Sidvall.Business.PropertyChangeEventData<string>(value, _DefaultUserContext);
                    OnBeforeDefaultUserContextPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("DefaultUserContext", eventData.Value, true, true);
                        OnAfterDefaultUserContextPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region IsEnabled

        private bool _IsEnabled;
        partial void OnBeforeIsEnabledPropertyChanged(Sidvall.Business.PropertyChangeEventData<bool> eventData);
        partial void OnAfterIsEnabledPropertyChanged();
        public bool IsEnabled
        { 
            get
            {
                return _IsEnabled;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _IsEnabled = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<bool> eventData = new Sidvall.Business.PropertyChangeEventData<bool>(value, _IsEnabled);
                    OnBeforeIsEnabledPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("IsEnabled", eventData.Value, true, true);
                        OnAfterIsEnabledPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region MissingUserPolicyId

        private global::Sidvall.AuthorizationManager.Data.MissingUserPolicy _MissingUserPolicyId;
        partial void OnBeforeMissingUserPolicyIdPropertyChanged(Sidvall.Business.PropertyChangeEventData<global::Sidvall.AuthorizationManager.Data.MissingUserPolicy> eventData);
        partial void OnAfterMissingUserPolicyIdPropertyChanged();
        public global::Sidvall.AuthorizationManager.Data.MissingUserPolicy MissingUserPolicyId
        { 
            get
            {
                return _MissingUserPolicyId;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _MissingUserPolicyId = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<global::Sidvall.AuthorizationManager.Data.MissingUserPolicy> eventData = new Sidvall.Business.PropertyChangeEventData<global::Sidvall.AuthorizationManager.Data.MissingUserPolicy>(value, _MissingUserPolicyId);
                    OnBeforeMissingUserPolicyIdPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("MissingUserPolicyId", eventData.Value, true, true);
                        OnAfterMissingUserPolicyIdPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region Name

        private string _Name;
        partial void OnBeforeNamePropertyChanged(Sidvall.Business.PropertyChangeEventData<string> eventData);
        partial void OnAfterNamePropertyChanged();
        public string Name
        { 
            get
            {
                return _Name;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _Name = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<string> eventData = new Sidvall.Business.PropertyChangeEventData<string>(value, _Name);
                    OnBeforeNamePropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("Name", eventData.Value, true, true);
                        OnAfterNamePropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region RequireActiveUser

        private bool _RequireActiveUser;
        partial void OnBeforeRequireActiveUserPropertyChanged(Sidvall.Business.PropertyChangeEventData<bool> eventData);
        partial void OnAfterRequireActiveUserPropertyChanged();
        public bool RequireActiveUser
        { 
            get
            {
                return _RequireActiveUser;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _RequireActiveUser = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<bool> eventData = new Sidvall.Business.PropertyChangeEventData<bool>(value, _RequireActiveUser);
                    OnBeforeRequireActiveUserPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("RequireActiveUser", eventData.Value, true, true);
                        OnAfterRequireActiveUserPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region ResourceItemPolicyId

        private global::Sidvall.AuthorizationManager.Data.ResourceItemActionPolicy _ResourceItemPolicyId;
        partial void OnBeforeResourceItemPolicyIdPropertyChanged(Sidvall.Business.PropertyChangeEventData<global::Sidvall.AuthorizationManager.Data.ResourceItemActionPolicy> eventData);
        partial void OnAfterResourceItemPolicyIdPropertyChanged();
        public global::Sidvall.AuthorizationManager.Data.ResourceItemActionPolicy ResourceItemPolicyId
        { 
            get
            {
                return _ResourceItemPolicyId;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _ResourceItemPolicyId = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<global::Sidvall.AuthorizationManager.Data.ResourceItemActionPolicy> eventData = new Sidvall.Business.PropertyChangeEventData<global::Sidvall.AuthorizationManager.Data.ResourceItemActionPolicy>(value, _ResourceItemPolicyId);
                    OnBeforeResourceItemPolicyIdPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("ResourceItemPolicyId", eventData.Value, true, true);
                        OnAfterResourceItemPolicyIdPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region ServerConnectionId

        private System.Nullable<System.Int32> _ServerConnectionId;
        partial void OnBeforeServerConnectionIdPropertyChanged(Sidvall.Business.PropertyChangeEventData<System.Nullable<System.Int32>> eventData);
        partial void OnAfterServerConnectionIdPropertyChanged();
        public System.Nullable<System.Int32> ServerConnectionId
        { 
            get
            {
                return _ServerConnectionId;
            }
            set
            {
                if (this.BusinessSettings.EnabledBusinessEvents == Sidvall.Business.BusinessEvents.None)
                {
                    _ServerConnectionId = value;
                }
                else
                {
                    Sidvall.Business.PropertyChangeEventData<System.Nullable<System.Int32>> eventData = new Sidvall.Business.PropertyChangeEventData<System.Nullable<System.Int32>>(value, _ServerConnectionId);
                    OnBeforeServerConnectionIdPropertyChanged(eventData);
                    if (!eventData.Cancel)
                    {
                        LoadInstanceField("ServerConnectionId", eventData.Value, true, true);
                        OnAfterServerConnectionIdPropertyChanged();
                    }
                }
            }
        }

        #endregion
        #region DataRowContextStorageKey

        protected override string DataRowContextStorageKey
        {
            get
            {
                return global::Sidvall.AuthorizationManager.SystemContext.Current.EntityFacade.AuthorizationScopeManager.GetKey(this);
            }
        }

        #endregion
        #region DataRowStateIsDirty

        protected override bool DataRowStateIsDirty
        {
            get
            {
                return global::Sidvall.AuthorizationManager.SystemContext.Current.EntityFacade.AuthorizationScopeManager.DataRowStateIsDirty(this);
            }
        }

        #endregion
        
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public AuthorizationScopeExportCollectionItem AuthorizationScopeExports { get; set; }
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public AuthorizationScopeResourceActionCollectionItem AuthorizationScopeResourceActions { get; set; }
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public AuthorizationScopeResourceItemCollectionItem AuthorizationScopeResourceItems { get; set; }
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public AuthorizationScopeUserCollectionItem AuthorizationScopeUsers { get; set; }
        #region LoadAuthorizationScopeExports

        public void LoadAuthorizationScopeExports(AuthorizationScopeExportCollectionItem value)
        {
            LoadInstanceField("AuthorizationScopeExports", value, true, false);
        }

        #endregion
        #region LoadAuthorizationScopeResourceActions

        public void LoadAuthorizationScopeResourceActions(AuthorizationScopeResourceActionCollectionItem value)
        {
            LoadInstanceField("AuthorizationScopeResourceActions", value, true, false);
        }

        #endregion
        #region LoadAuthorizationScopeResourceItems

        public void LoadAuthorizationScopeResourceItems(AuthorizationScopeResourceItemCollectionItem value)
        {
            LoadInstanceField("AuthorizationScopeResourceItems", value, true, false);
        }

        #endregion
        #region LoadAuthorizationScopeUsers

        public void LoadAuthorizationScopeUsers(AuthorizationScopeUserCollectionItem value)
        {
            LoadInstanceField("AuthorizationScopeUsers", value, true, false);
        }

        #endregion
        #region LoadAuthorizationScopeExportsAsync

        public async System.Threading.Tasks.Task<AuthorizationScopeExportCollectionItem> LoadAuthorizationScopeExportsAsync()
        {
            return await LoadAuthorizationScopeExportsAsync(false, true, null, null, null).ConfigureAwait(false);
        }
        public async System.Threading.Tasks.Task<AuthorizationScopeExportCollectionItem> LoadAuthorizationScopeExportsAsync(bool refresh, bool raisePropertyChanged, global::Sidvall.Data.FetchListCriteria<global::Sidvall.AuthorizationManager.Data.Fields.AuthorizationScopeExportField, global::Sidvall.AuthorizationManager.Data.Relations.AuthorizationScopeExportRelation> criteria, string strategyContext, global::Sidvall.Data.ObjectParameterCollection objectParameters)
        {
            await global::Sidvall.AuthorizationManager.SystemContext.Current.DataPortal.AuthorizationScopeManager.LoadAuthorizationScopeExportsAsync(this, refresh, raisePropertyChanged, criteria, strategyContext, objectParameters).ConfigureAwait(false);

            return this.AuthorizationScopeExports;
        }

        #endregion
        #region LoadAuthorizationScopeResourceActionsAsync

        public async System.Threading.Tasks.Task<AuthorizationScopeResourceActionCollectionItem> LoadAuthorizationScopeResourceActionsAsync()
        {
            return await LoadAuthorizationScopeResourceActionsAsync(false, true, null, null, null).ConfigureAwait(false);
        }
        public async System.Threading.Tasks.Task<AuthorizationScopeResourceActionCollectionItem> LoadAuthorizationScopeResourceActionsAsync(bool refresh, bool raisePropertyChanged, global::Sidvall.Data.FetchListCriteria<global::Sidvall.AuthorizationManager.Data.Fields.AuthorizationScopeResourceActionField, global::Sidvall.AuthorizationManager.Data.Relations.AuthorizationScopeResourceActionRelation> criteria, string strategyContext, global::Sidvall.Data.ObjectParameterCollection objectParameters)
        {
            await global::Sidvall.AuthorizationManager.SystemContext.Current.DataPortal.AuthorizationScopeManager.LoadAuthorizationScopeResourceActionsAsync(this, refresh, raisePropertyChanged, criteria, strategyContext, objectParameters).ConfigureAwait(false);

            return this.AuthorizationScopeResourceActions;
        }

        #endregion
        #region LoadAuthorizationScopeResourceItemsAsync

        public async System.Threading.Tasks.Task<AuthorizationScopeResourceItemCollectionItem> LoadAuthorizationScopeResourceItemsAsync()
        {
            return await LoadAuthorizationScopeResourceItemsAsync(false, true, null, null, null).ConfigureAwait(false);
        }
        public async System.Threading.Tasks.Task<AuthorizationScopeResourceItemCollectionItem> LoadAuthorizationScopeResourceItemsAsync(bool refresh, bool raisePropertyChanged, global::Sidvall.Data.FetchListCriteria<global::Sidvall.AuthorizationManager.Data.Fields.AuthorizationScopeResourceItemField, global::Sidvall.AuthorizationManager.Data.Relations.AuthorizationScopeResourceItemRelation> criteria, string strategyContext, global::Sidvall.Data.ObjectParameterCollection objectParameters)
        {
            await global::Sidvall.AuthorizationManager.SystemContext.Current.DataPortal.AuthorizationScopeManager.LoadAuthorizationScopeResourceItemsAsync(this, refresh, raisePropertyChanged, criteria, strategyContext, objectParameters).ConfigureAwait(false);

            return this.AuthorizationScopeResourceItems;
        }

        #endregion
        #region LoadAuthorizationScopeUsersAsync

        public async System.Threading.Tasks.Task<AuthorizationScopeUserCollectionItem> LoadAuthorizationScopeUsersAsync()
        {
            return await LoadAuthorizationScopeUsersAsync(false, true, null, null, null).ConfigureAwait(false);
        }
        public async System.Threading.Tasks.Task<AuthorizationScopeUserCollectionItem> LoadAuthorizationScopeUsersAsync(bool refresh, bool raisePropertyChanged, global::Sidvall.Data.FetchListCriteria<global::Sidvall.AuthorizationManager.Data.Fields.AuthorizationScopeUserField, global::Sidvall.AuthorizationManager.Data.Relations.AuthorizationScopeUserRelation> criteria, string strategyContext, global::Sidvall.Data.ObjectParameterCollection objectParameters)
        {
            await global::Sidvall.AuthorizationManager.SystemContext.Current.DataPortal.AuthorizationScopeManager.LoadAuthorizationScopeUsersAsync(this, refresh, raisePropertyChanged, criteria, strategyContext, objectParameters).ConfigureAwait(false);

            return this.AuthorizationScopeUsers;
        }

        #endregion
        #region LoadInstanceField

        public void LoadInstanceField(string fieldName, object value, bool cascade, bool updateState)
        {
            global::Sidvall.AuthorizationManager.SystemContext.Current.EntityFacade.AuthorizationScopeManager.LoadInstanceField(this, fieldName, value, cascade, false, updateState);
        }

        #endregion
        #region Copy

        public AuthorizationScope Copy()
        {
            return global::Sidvall.AuthorizationManager.SystemContext.Current.EntityFacade.AuthorizationScopeManager.Copy(this);
        }
        public AuthorizationScope Copy(Sidvall.Data.CopySettings settings)
        {
            return global::Sidvall.AuthorizationManager.SystemContext.Current.EntityFacade.AuthorizationScopeManager.Copy(this, settings);
        }

        #endregion
        #region Import

        public void Import(global::Sidvall.AuthorizationManager.Data.IAuthorizationScope item)
        {
            global::Sidvall.AuthorizationManager.SystemContext.Current.EntityFacade.AuthorizationScopeManager.Import(this, item);
        }
        public void Import(global::Sidvall.AuthorizationManager.Data.IAuthorizationScope item, Sidvall.Data.CopySettings settings)
        {
            global::Sidvall.AuthorizationManager.SystemContext.Current.EntityFacade.AuthorizationScopeManager.Import(this, item, settings);
        }

        #endregion
        #region SaveItemAsync

        public async System.Threading.Tasks.Task<AuthorizationScope> SaveItemAsync()
        {
            return await global::Sidvall.AuthorizationManager.SystemContext.Current.DataPortal.AuthorizationScopeManager.SaveItemAsync(this).ConfigureAwait(false);
        }
        public async System.Threading.Tasks.Task<AuthorizationScope> SaveItemAsync(Sidvall.Data.SaveMode mode)
        {
            return await global::Sidvall.AuthorizationManager.SystemContext.Current.DataPortal.AuthorizationScopeManager.SaveItemAsync(this, mode).ConfigureAwait(false);
        }
        public async System.Threading.Tasks.Task<AuthorizationScope> SaveItemAsync(Sidvall.Data.SaveSettings settings)
        {
            return await global::Sidvall.AuthorizationManager.SystemContext.Current.DataPortal.AuthorizationScopeManager.SaveItemAsync(this, settings).ConfigureAwait(false);
        }
        public async System.Threading.Tasks.Task<AuthorizationScope> SaveItemAsync(Sidvall.Data.SaveSettings settings, string strategyContext, global::Sidvall.Data.ObjectParameterCollection objectParameters)
        {
            return await global::Sidvall.AuthorizationManager.SystemContext.Current.DataPortal.AuthorizationScopeManager.SaveItemAsync(this, settings, strategyContext, objectParameters).ConfigureAwait(false);
        }

        #endregion
        #region ValidateAsync

        public async System.Threading.Tasks.Task<Sidvall.Data.BusinessRuleCollection> ValidateAsync()
        {
            return await global::Sidvall.AuthorizationManager.SystemContext.Current.EntityFacade.AuthorizationScopeManager.ValidateAsync(this).ConfigureAwait(false);
        }
        public async System.Threading.Tasks.Task<Sidvall.Data.BusinessRuleCollection> ValidateAsync(Sidvall.Data.ValidationSettings settings)
        {
            return await global::Sidvall.AuthorizationManager.SystemContext.Current.EntityFacade.AuthorizationScopeManager.ValidateAsync(this, settings).ConfigureAwait(false);
        }

        #endregion
        #region Initialize

        public void Initialize()
        {
            global::Sidvall.AuthorizationManager.SystemContext.Current.EntityFacade.AuthorizationScopeManager.Initialize(this);
        }
        public void Initialize(Sidvall.Data.InitializeSettings settings)
        {
            global::Sidvall.AuthorizationManager.SystemContext.Current.EntityFacade.AuthorizationScopeManager.Initialize(this, settings);
        }

        #endregion

        #region IAuthorizationScope Members

        System.Nullable<long> global::Sidvall.AuthorizationManager.Data.IAuthorizationScope.AuthorizationScopeId
        {
            get
            {
                return this._AuthorizationScopeId;
            }
            set
            {
                this._AuthorizationScopeId = value;
            }
        }
        global::Sidvall.AuthorizationManager.Data.AuthorizationScopeAccessLevel global::Sidvall.AuthorizationManager.Data.IAuthorizationScope.DefaultResourceActionAccessLevel
        {
            get
            {
                return this._DefaultResourceActionAccessLevel;
            }
            set
            {
                this._DefaultResourceActionAccessLevel = value;
            }
        }
        global::Sidvall.AuthorizationManager.Data.AuthorizationScopeAccessLevel global::Sidvall.AuthorizationManager.Data.IAuthorizationScope.DefaultResourceItemAccessLevel
        {
            get
            {
                return this._DefaultResourceItemAccessLevel;
            }
            set
            {
                this._DefaultResourceItemAccessLevel = value;
            }
        }
        string global::Sidvall.AuthorizationManager.Data.IAuthorizationScope.DefaultUserContext
        {
            get
            {
                return this._DefaultUserContext;
            }
            set
            {
                this._DefaultUserContext = value;
            }
        }
        bool global::Sidvall.AuthorizationManager.Data.IAuthorizationScope.IsEnabled
        {
            get
            {
                return this._IsEnabled;
            }
            set
            {
                this._IsEnabled = value;
            }
        }
        global::Sidvall.AuthorizationManager.Data.MissingUserPolicy global::Sidvall.AuthorizationManager.Data.IAuthorizationScope.MissingUserPolicyId
        {
            get
            {
                return this._MissingUserPolicyId;
            }
            set
            {
                this._MissingUserPolicyId = value;
            }
        }
        string global::Sidvall.AuthorizationManager.Data.IAuthorizationScope.Name
        {
            get
            {
                return this._Name;
            }
            set
            {
                this._Name = value;
            }
        }
        bool global::Sidvall.AuthorizationManager.Data.IAuthorizationScope.RequireActiveUser
        {
            get
            {
                return this._RequireActiveUser;
            }
            set
            {
                this._RequireActiveUser = value;
            }
        }
        global::Sidvall.AuthorizationManager.Data.ResourceItemActionPolicy global::Sidvall.AuthorizationManager.Data.IAuthorizationScope.ResourceItemPolicyId
        {
            get
            {
                return this._ResourceItemPolicyId;
            }
            set
            {
                this._ResourceItemPolicyId = value;
            }
        }
        System.Nullable<System.Int32> global::Sidvall.AuthorizationManager.Data.IAuthorizationScope.ServerConnectionId
        {
            get
            {
                return this._ServerConnectionId;
            }
            set
            {
                this._ServerConnectionId = value;
            }
        }
        System.Collections.Generic.IEnumerable<global::Sidvall.AuthorizationManager.Data.IAuthorizationScopeExport> global::Sidvall.AuthorizationManager.Data.IAuthorizationScope.AuthorizationScopeExports
        {
            get
            {
                if (this.AuthorizationScopeExports != null)
                    return this.AuthorizationScopeExports.Items;
                return null;
            }
        }
        void global::Sidvall.AuthorizationManager.Data.IAuthorizationScope.SetAuthorizationScopeExports(Sidvall.Data.IDataRowProvider<global::Sidvall.AuthorizationManager.Data.IAuthorizationScopeExport> items)
        {
            this.AuthorizationScopeExports = (AuthorizationScopeExportCollectionItem)items;
        }
        System.Collections.Generic.IEnumerable<global::Sidvall.AuthorizationManager.Data.IAuthorizationScopeResourceAction> global::Sidvall.AuthorizationManager.Data.IAuthorizationScope.AuthorizationScopeResourceActions
        {
            get
            {
                if (this.AuthorizationScopeResourceActions != null)
                    return this.AuthorizationScopeResourceActions.Items;
                return null;
            }
        }
        void global::Sidvall.AuthorizationManager.Data.IAuthorizationScope.SetAuthorizationScopeResourceActions(Sidvall.Data.IDataRowProvider<global::Sidvall.AuthorizationManager.Data.IAuthorizationScopeResourceAction> items)
        {
            this.AuthorizationScopeResourceActions = (AuthorizationScopeResourceActionCollectionItem)items;
        }
        System.Collections.Generic.IEnumerable<global::Sidvall.AuthorizationManager.Data.IAuthorizationScopeResourceItem> global::Sidvall.AuthorizationManager.Data.IAuthorizationScope.AuthorizationScopeResourceItems
        {
            get
            {
                if (this.AuthorizationScopeResourceItems != null)
                    return this.AuthorizationScopeResourceItems.Items;
                return null;
            }
        }
        void global::Sidvall.AuthorizationManager.Data.IAuthorizationScope.SetAuthorizationScopeResourceItems(Sidvall.Data.IDataRowProvider<global::Sidvall.AuthorizationManager.Data.IAuthorizationScopeResourceItem> items)
        {
            this.AuthorizationScopeResourceItems = (AuthorizationScopeResourceItemCollectionItem)items;
        }
        System.Collections.Generic.IEnumerable<global::Sidvall.AuthorizationManager.Data.IAuthorizationScopeUser> global::Sidvall.AuthorizationManager.Data.IAuthorizationScope.AuthorizationScopeUsers
        {
            get
            {
                if (this.AuthorizationScopeUsers != null)
                    return this.AuthorizationScopeUsers.Items;
                return null;
            }
        }
        void global::Sidvall.AuthorizationManager.Data.IAuthorizationScope.SetAuthorizationScopeUsers(Sidvall.Data.IDataRowProvider<global::Sidvall.AuthorizationManager.Data.IAuthorizationScopeUser> items)
        {
            this.AuthorizationScopeUsers = (AuthorizationScopeUserCollectionItem)items;
        }

        #endregion

        #endregion
        #region Constructors

        public AuthorizationScope()
        {
        }
        public AuthorizationScope(bool initializeDefaultValues)
            : this(initializeDefaultValues, null, Sidvall.Business.BusinessEvents.None)
        {
        }
        public AuthorizationScope(bool initializeDefaultValues, Sidvall.Data.DataRowState? dataRowState, Sidvall.Business.BusinessEvents enabledBusinessEvents)
            : base(dataRowState, enabledBusinessEvents)
        {
            if (initializeDefaultValues)
                global::Sidvall.AuthorizationManager.SystemContext.Current.EntityFacade.AuthorizationScopeManager.Initialize(this);
        }

        #endregion
    }
}